//
//  NSDictionary+SleepUsed.m
//  CareRingApp
//
//  Created by Linktop on 2022/8/8.
//
#import "NSDictionary+SleepUsed.h"

NSString  * const FIRST = @"first";
NSString  * const SECOND = @"second";
NSString  * const THIRD = @"third";
NSString  * const FOURTH = @"fourth";
NSString  * const SLEEP_STAG_TYPE = @"SleepStagingType";
NSString  * const SLEEP_STAG_LIST = @"list";

@implementation NSDictionary (SleepUsed)


//-(NSNumber *)time {
//    
//    return self[SLEEP_KEY_TIME];
//    
//}
//
//-(NSNumber *)hr {
//    
//    return self[SLEEP_KEY_HR];
//}
//
//-(NSArray <NSDictionary *>*)list
//{
//    
//    return self[SLEEP_STAG_LIST];
//}

-(id)first {
    
    return self[FIRST];
}

-(id)second {
    return self[SECOND];
}

-(id)third {
    return self[THIRD];
}

-(id)fourth {
    return self[FOURTH];
}

-(SleepStagingType)type
{
    return [self[SLEEP_STAG_TYPE] unsignedIntValue];
}

-(NSString *)androidFormat:(NSDateFormatter *)dateFormatter
{
    /*
     mutDict.first = @([rs doubleForColumn:@"time"]);

     mutDict.third = @([rs intForColumn:@"soprtTimes"]);

     mutDict.second = @([rs intForColumn:@"deviceModifyHeartRate"]);
     */
    NSString *timeStr = [dateFormatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:[self.first doubleValue]]];
    NSString *str = [NSString stringWithFormat:@"%@\t1\t%@\t%@\r\n", timeStr, self.third, self.second];
    
    return str;
    
}

@end
